<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 200px;
            height: 200px;
        }
    </style>
</head>

<body>
    <div class="box">123</div>
    <div class="box">456</div>
    <p id="nav">导航栏</p>
    <ul>
        <li>首页</li>
        <li>新闻</li>
        <li>产品</li>
    </ul>
    <script>
// const box =document.querySelector('.box');
// 里面写css选择器，必须是字符串，也要加引号
// const li = document.querySelectorAll('ul li:first-child');
// console.log(li);
const lis = document.querySelectorAll('ul li');
p[0].style.color = 'blue';
for (let i = 0; i < lis.length; i++) {
    console.log(lis[i]);
    }

    </script>
</body>
</html>